﻿using System;
using System.Windows;

namespace SnakeGame.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private bool isMax;
        public MainWindow()
        {
            InitializeComponent();

            MainFrame mainFrame = FindName("MainFrame") as MainFrame;
            if (mainFrame != null)
            {
                mainFrame.Window = this;
            }
        }

        private void MainWindow_OnStateChanged(object sender, EventArgs e)
        {
            if (WindowState == WindowState.Maximized && !isMax)
            {
                isMax = true;
                this.WindowState = WindowState.Normal;
                WindowStyle = WindowStyle.None;
                ResizeMode = ResizeMode.NoResize;
                WindowState = WindowState.Maximized;
                isMax = false;
            }
        }
    }
}
